package com.shouhuobao.visit;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.collectplus.express.R;
import com.collectplus.express.model.VisitDoorBean;

import java.util.ArrayList;

import droid.frame.activity.base.BaseAdapterExt;

/**
 * 上门地址
 * Created by lidandan on 2017/12/13.
 */

public class VisitAddressAdapter extends BaseAdapterExt<VisitDoorBean> {//这里需要加bean类

    public VisitAddressAdapter(ArrayList<VisitDoorBean> items, Activity context) {
        super(items, context);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        if (convertView == null || convertView.getTag() == null) {
            holder = new ViewHolder();
            convertView = LayoutInflater.from(context).inflate(R.layout.visit_address_item, parent, false);
            holder.mAddressTv = (TextView) convertView.findViewById(R.id.address_tv);
            holder.mAddressDetailTv = (TextView) convertView.findViewById(R.id.address_detail_tv);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
       final VisitDoorBean visitDoorBean = getItem(position);
        holder.mAddressTv.setText(visitDoorBean.getBuildName());
        holder.mAddressDetailTv.setText(visitDoorBean.getAddress());
        return convertView;
    }

    class ViewHolder {
        TextView mAddressTv;
        TextView mAddressDetailTv;

    }
}
